# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/lineageos_v1awifi_defconfig

pkgname=linux-samsung-v1awifi
pkgver=3.4.113
pkgrel=0
pkgdesc="Samsung Galaxy Note Pro 12.2 Wi-Fi kernel fork"
arch="armv7"
_carch="arm"
_flavor="samsung-v1awifi"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="
	bash
	bc
	bison
	devicepkg-dev
	flex
	openssl-dev
	perl
	xz
	"

# Source
_repository="android_kernel_samsung_exynos5420"
_commit="875b08faaa1a395c233388b4048e4b20bf971db3"
_config="config-$_flavor.$arch"
source="
	$pkgname-$_commit.tar.gz::https://github.com/exynos5420/$_repository/archive/$_commit.tar.gz
	$_config
	03-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
	gcc7-give-up-on-ilog2-const-optimizations.patch
	gcc8-fix-put-user.patch
	gcc10-extern_YYLOC_global_declaration.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"

prepare() {
	default_prepare
	. downstreamkernel_prepare
}

build() {
	unset LDFLAGS
	make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
		KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}

package() {
	downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
}

sha512sums="
807e43b896d83f0a633aa417ad7ffd0a8af3aa5da2c4b1134b604fdadb26b590f04ff24131b3ee2b60b0479ce2e6ba81e3e19e50e0e772d9785b96d60aa65c33  linux-samsung-v1awifi-875b08faaa1a395c233388b4048e4b20bf971db3.tar.gz
028c97dba02b6ec55015e9b822ca017095a98d562e4f75124cb3317313b7062798dbc71e98223e4e1948e5d8ed17c8749313072fb7b9ff37b51d439efdc049d9  config-samsung-v1awifi.armv7
5fad0940e90da71277b70b6e72fbb75fcc5e12625e65f827ae896d448628b252b3312539f9c184b26ffe5ca3b343a56b388ea6addb7fe446c7d1ae2aefb4b51e  03-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7  gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967  gcc8-fix-put-user.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb  gcc10-extern_YYLOC_global_declaration.patch
"
